GEN_SRC := NodeService.cpp mp2_constants.cpp mp2_types.cpp sha1.c
GEN_OBJ := $(patsubst %.cpp,%.o, $(GEN_SRC))
CXX += -DHAVE_NETINET_IN_H -g
THRIFT_DIR := /class/ece428/libs/include/thrift
BOOST_DIR := /usr/local/include

INC += -I$(THRIFT_DIR) -I$(BOOST_DIR) -I${HOME}/include

LINK += -L/class/ece428/libs/lib -Wl,-rpath,/class/ece428/libs/lib -Wl,-rpath,${HOME}/lib -levent -lthriftnb

.PHONY: all clean

all: node listener

%.o: %.cpp
	$(CXX) -Wall $(INC) -c $< -o $@

node: WrappedNode.o node.o util.o $(GEN_OBJ)
	$(CXX) $(LINK) -lthrift $^ -o $@

listener: WrappedNode.o listener.o util.o $(GEN_OBJ)
	$(CXX) $(LINK) -lthrift $^ -o $@

clean:
	$(RM) *.o node listener
